﻿using System;
using BITS.PreCompiler.CSharp.Syntax;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace BITS.PreCompiler.CSharp.Tests.Syntax
{
    [TestClass]
    public class TestField : TestBase
    {
        [TestMethod]
        public void Create_Field()
        {
            var @field = new Field(@identifier: "myField",
                @modifier: Modifier.Public, @type: "String");

            var expectet = Comparer.Create_Field();
            var actual   = @field.ToString();

            Assert.AreEqual(expectet, actual);
            Console.WriteLine(actual);
        }

        [TestMethod]
        public void Create_Field_With_Value()
        {
            var @using = new Field(@identifier: "myField", @type: "Object")
                .WithExpression("1");

            var expectet = Comparer.Create_Field_With_Value();
            var actual   = @using.ToString();

            Assert.AreEqual(expectet, actual);
            Console.WriteLine(actual);
        }


        public static class Comparer
        {
            public static String Create_Field()
            {
                return
@"public String myField;";
            }

            public static String Create_Field_With_Value()
            {
                return
@"private Object myField = 1;";
            }
        }
    }
}
